import 'package:flutter/material.dart';
import 'package:fluro/fluro.dart';
import 'package:flutter_example/routers/router_tool.dart';
import './router_handle.dart';
import './not_found.dart';
import '../page/flu_widget/flu_widget_router_handle.dart';
import '../page/dialog_page.dart';

class Routes {
  static String root = '/';
  static String routerPage = '/routerIndex';
  static String simple = '/demo';
  static String simpleFixedTrans = '/demo/fixedtrans';
  static String demoFunc = '/demo/func';
  static String deepLink = '/message';
  static String favoritePage = '/favoritePage';
  static String peoplePage = '/peoplePage';
  static String counterPage = '/counterPage';
  static String quizPage = '/quizPage';
  static String widgetList = '/widgetList';
  static String nativePage = '/nativePage';
  
  static void configureRoutes(FluroRouter router) {
    router.notFoundHandler = Handler(
      handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
        print('Router Not Found!!!');
        return const NotFoundPage();
      },
    );
    router.define(root, handler: rootHandler);
    //
    router.define(routerPage, handler: routerIndexHandler);
    router.define(simple, handler: demoRouterHandler);
    router.define(simpleFixedTrans, handler: demoRouterHandler, transitionType: TransitionType.inFromLeft);
    router.define(demoFunc, handler: demoFunctionHandler);
    router.define(deepLink, handler: deepLinkHandler);
    //
    router.define(favoritePage, handler: favouriteHandler);
    router.define(peoplePage, handler: peoplePageHandler);
    router.define(counterPage, handler: counterPageHandler);
    router.define(quizPage, handler: quizPageHandler);
    router.define(widgetList, handler: widgetListHandler);
    // flutter widgets
    router.define(licenseIndexPage, handler: licenseIndexPageHandler);
    router.define(licenseSimplePage, handler: licenseSimplePageHandler);
    router.define(licenseCustomPage, handler: licenseCustomPageHandler);
    router.define(licenseRegistryPage, handler: licenseRegistryPageHandler);
    router.define(licenseTilePage, handler: licenseTilePageHandler);
    router.define(absorbPointerPage, handler: absorbPointerPageHandler);
    router.define(chipPage, handler: chipPageHandler);
    router.define(layoutPage, handler: layoutPage1Handler);
    // native view & native method
    router.define('/dialog_page', handler: routerHandler(DialogPage()));
    router.define(nativePage, handler: nativeViewHandler);
  }
}
